!include "MUI.nsh" ; what compression to use (see help) SetCompressor /FINAL /SOLID lzma ; The name of the installer Name "Drone Hockey" ; The file to write OutFile "DroneHockeySetup.exe" ; The default installation directory InstallDir "c:\UT2004\" ; Registry key to check for directory (so if you install again, it will ; overwrite the old one automatically) InstallDirRegKey HKLM "SOFTWARE\DroneHockey" "Install_Dir" ; Request application privileges for Windows Vista RequestExecutionLevel admin ;-------------------------------- ;Interface Settings !define MUI_ABORTWARNING ;-------------------------------- ;Pages ;Add a directory page to let the user specify a plug-ins folder ;Store the folder in $PluginsFolder !define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of the Drone Hockey Unreal 2004 Mod.\r\n\r\nIt is necessary to have Unreal Tournament 2004 installed prior to installing Drone Hockey. If you do not have Unreal Tournament 2004 installed, please install that first and then re-run this installation program. You will need write permission to your Unreal 2004 directory for the install to work successfully. Furthermore, you should have the v3369 or later patch installed.\r\n\r\n$_CLICK" !insertmacro MUI_PAGE_WELCOME !define MUI_PAGE_CUSTOMFUNCTION_LEAVE checkUT2004 !define MUI_PAGE_HEADER_SUBTEXT "Please enter the path to your Unreal Tournament 2004 directory." !define MUI_DIRECTORYPAGE_TEXT_TOP "Drone Hockey setup needs to install files to your Unreal Tournament 2004 directory. The default location for UT2004 is shown below. If you installed Unreal Tournament 2004 in a different location, please change the location below to match. All Drone Hockey files will be installed into a mod sub-folder named 'DroneHockey'." !insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_UNPAGE_CONFIRM !insertmacro MUI_UNPAGE_INSTFILES ; function that verifies that UT2004 is installed Function checkUT2004 FindFirst $0 $1 $INSTDIR\System\UT2004.exe StrCmp $1 "" error FindFirst $0 $1 $INSTDIR\System\Setup.exe StrCmp $1 "" error IfFileExists $INSTDIR\DroneHockey\*.* alreadyinstalled Goto end error: MessageBox MB_OK "Unreal Tournament 2004 doesn't seem to be installed there!" Abort Goto end alreadyinstalled: MessageBox MB_OK "Drone Hockey seems to be already installed! If this is not the case, remove the 'DroneHockey' subfolder in your Unreal Tournament directory." Abort Goto end end: FunctionEnd ;-------------------------------- ;Languages !insertmacro MUI_LANGUAGE "English" ;-------------------------------- ;DirText "Drone Hockey setup needs to install files to your Unreal Tournament 2004 directory. The default location for UT2004 is shown below. If you installed Unreal Tournament 2004 in a different location, please change the location below to match. All Drone Hockey files will be installed into a mod sub-folder named 'DroneHockey'." "Subtext" ;-------------------------------- ; The stuff to install Section "" ;SectionIn RO CreateDirectory $INSTDIR\DroneHockey ; Set output path to the installation directory. SetOutPath $INSTDIR\DroneHockey ; files to install File /r "FilesToInstall\*.*" ; Write the installation path into the registry WriteRegStr HKLM "SOFTWARE\DroneHockey" "Install_Dir" "$INSTDIR" ; Write the uninstall keys for Windows WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\DroneHockey" "DisplayName" "Drone Hockey Unreal Tournament 2004 Mod (Remove only)" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\DroneHockey" "UninstallString" '"$INSTDIR\DroneHockey\UninstallDroneHockey.exe"' WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\DroneHockey" "NoModify" 1 WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\DroneHockey" "NoRepair" 1 WriteUninstaller "$INSTDIR\DroneHockey\UninstallDroneHockey.exe" ; create shortcuts CreateShortCut "$INSTDIR\DroneHockey\Drone Hockey (UT2004).lnk" "$INSTDIR\System\UT2004.exe" "-mod=DroneHockey" "$INSTDIR\System\UT2004.exe" 0 CreateShortCut "$SMPROGRAMS\Drone Hockey (UT2004).lnk" "$INSTDIR\System\UT2004.exe" "-mod=DroneHockey" "$INSTDIR\System\UT2004.exe" 0 CreateShortCut "$DESKTOP\Drone Hockey (UT2004).lnk" "$INSTDIR\System\UT2004.exe" "-mod=DroneHockey" "$INSTDIR\System\UT2004.exe" 0 SectionEnd ;-------------------------------- ;Uninstaller Section Section "Uninstall" ; Remove registry keys DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\DroneHockey" DeleteRegKey HKLM "SOFTWARE\DroneHockey" ; Remove shortcuts Delete "$INSTDIR\Drone Hockey (UT2004).lnk" Delete "$SMPROGRAMS\Drone Hockey (UT2004).lnk" Delete "$DESKTOP\Drone Hockey (UT2004).lnk" ; Remove uninstaller Delete "$INSTDIR\UninstallDroneHockey.exe" ; Remove directories used RMDir /r "$INSTDIR\maps" RMDir /r "$INSTDIR\StaticMeshes" RMDir /r "$INSTDIR\System" RMDir /r "$INSTDIR\Animations" RMDir /r "$INSTDIR\DHGame" RMDir /r "$INSTDIR\DHGui" RMDir /r "$INSTDIR\Textures" RMDir /r "$INSTDIR\Sounds" Delete "$INSTDIR\DroneHockey.bat" Delete "$INSTDIR\UT2k4Mod.ini" RMDir "$INSTDIR" SectionEnd